package dai.ui

import android.view.View
import dai.ui.single.*
import dai.ui.composition.Parallel
import dai.ui.composition.Repeat


//----------------------------
// move
fun  UITween.moveTo(duration:Float,dstX:Float,dstY:Float):UITween{
    nextTween = MoveTo(duration,dstX,dstY)
    (nextTween as MoveTo).headTween = headTween
    return nextTween!!
}

fun  UITween.moveBy(duration: Float,dx:Float,dy:Float):UITween{
    nextTween = MoveBy(duration,dx,dy)
    (nextTween as MoveBy).headTween = headTween
    return  nextTween!!
}

//----------------------------
// scale
fun  UITween.scaleTo(duration:Float,dstSx:Float,dstSy:Float):UITween{
    nextTween = ScaleTo(duration,dstSx,dstSy)
    (nextTween as ScaleTo).headTween = headTween
    return nextTween!!
}
fun  UITween.scaleBy(duration:Float,dxSx:Float,dxSy:Float):UITween{
    nextTween = ScaleBy(duration,dxSx,dxSy)
    (nextTween as ScaleBy).headTween = headTween
    return nextTween!!
}

//----------------------------
// rotate
fun  UITween.rotateTo(duration: Float,dstDegress:Float):UITween{
    nextTween = RotateTo(duration,dstDegress)
    (nextTween as RotateTo).headTween = headTween
    return nextTween!!
}

fun  UITween.rotateBy(duration: Float,dxDegress:Float):UITween{
    nextTween = RotateBy(duration,dxDegress)
    (nextTween as RotateBy).headTween = headTween
    return nextTween!!
}

//----------------------------
// delay
fun  UITween.delay(t:Float):UITween{
    nextTween = Delay(t)
    (nextTween as Delay).headTween = headTween
    return nextTween!!
}

//----------------------------
// call
fun  UITween.call(action: (View) -> Unit):UITween{
    nextTween = Call(action)
    (nextTween as Call).headTween = headTween
    return  nextTween!!
}

//----------------------------
// parallel
fun  UITween.parallel(vararg tween:UITween):UITween{
    nextTween = Parallel(*tween)
    (nextTween as Parallel).headTween = headTween
    return  nextTween!!
}


//----------------------------
// repeat
fun  UITween.repeat(count:Int,tween:UITween):UITween{
    nextTween = Repeat(count,tween)
    (nextTween as Repeat).headTween = headTween
    return nextTween!!
}

